package com.glsc.ngateway.common.base.repo.mysql.gateway.other;

import com.glsc.ngateway.common.base.domain.mysql.gateway.other.TradeAccountSaleFund;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface TradeAccountSaleFundRepository extends JpaRepository<TradeAccountSaleFund, Integer>, JpaSpecificationExecutor<TradeAccountSaleFund> {
    @Query(value = "select m from TradeAccountSaleFund m where m.dataStatus=0 " +
//            "and (:#{#paramSearchDto.shareHolderAccount} is null OR m.shareHolderAccount = :#{#paramSearchDto.shareHolderAccount})  " +
//            "and (:#{#paramSearchDto.shareHolderAccountName} is null OR m.shareHolderAccountName = :#{#paramSearchDto.shareHolderAccountName})  " +
            "and (:#{#paramSearchDto.platName} is null OR m.platName LIKE CONCAT('%',:#{#paramSearchDto.platName},'%') )  " +
            "AND (:#{#paramSearchDto.accountUseInfo} is null OR m.accountUseInfo LIKE CONCAT('%',:#{#paramSearchDto.accountUseInfo},'%')) " +
            "AND (:#{#paramSearchDto.account} is null OR m.account LIKE CONCAT('%',:#{#paramSearchDto.account},'%')) " +
            "AND (:#{#paramSearchDto.saleFundRelateBank} is null OR m.saleFundRelateBank LIKE CONCAT('%',:#{#paramSearchDto.saleFundRelateBank},'%')) " +
            "AND (:#{#paramSearchDto.admin} is null OR m.admin LIKE CONCAT('%',:#{#paramSearchDto.admin},'%')) " +
            "AND (:#{#paramSearchDto.operator} is null OR m.operator LIKE CONCAT('%',:#{#paramSearchDto.operator},'%')) " +
            "AND (:#{#paramSearchDto.saleFundPhone} is null OR m.saleFundPhone LIKE CONCAT('%',:#{#paramSearchDto.saleFundPhone},'%')) " +
            "AND (:#{#paramSearchDto.relateInfo} is null OR m.relateInfo LIKE CONCAT('%',:#{#paramSearchDto.relateInfo},'%')) " +
            "AND (:#{#paramSearchDto.saleFundRelateBankSelectName} is null OR m.saleFundRelateBankSelectName LIKE CONCAT('%',:#{#paramSearchDto.saleFundRelateBankSelectName},'%'))" +
            "AND (:#{#paramSearchDto.openDate} is null OR m.openDate LIKE CONCAT('%',:#{#paramSearchDto.openDate},'%'))" +
            "AND (:#{#paramSearchDto.adminAccount} is null OR m.adminAccount LIKE CONCAT('%',:#{#paramSearchDto.adminAccount},'%'))" +
            "AND (:#{#paramSearchDto.operatorAccount} is null OR m.operatorAccount LIKE CONCAT('%',:#{#paramSearchDto.operatorAccount},'%'))" +
//            "and (:#{#paramSearchDto.shareHolderAccountName} is null OR m.shareHolderAccountName LIKE CONCAT('%',:#{#paramSearchDto.shareHolderAccountName},'%') )  " +
//            "and (:#{#paramSearchDto.market} is null OR m.market = :#{#paramSearchDto.market})  " +
//            "and (:#{#paramSearchDto.status} is null OR m.status = :#{#paramSearchDto.status})  " +
//            "and (:#{#paramSearchDto.shareHolderUseDepartment} is null OR m.shareHolderUseDepartment = :#{#paramSearchDto.shareHolderUseDepartment})  " +
//            "and (:#{#paramSearchDto.belongDeptId} is null OR m.belongDeptId = :#{#paramSearchDto.belongDeptId})  " +
//            "and (:#{#paramSearchDto.opSupportName} is null OR m.opSupportName LIKE CONCAT('%',:#{#paramSearchDto.opSupportName},'%') )  " +
//            "and (:#{#paramSearchDto.systemSummary} is null OR m.systemSummary LIKE CONCAT('%',:#{#paramSearchDto.systemSummary},'%') )  " +
//            "and (:#{#paramSearchDto.processDefineKey} is null OR m.processDefineKey = :#{#paramSearchDto.processDefineKey} )  " +
//            "and (:#{#paramSearchDto.systemCode} is null OR m.systemCode = :#{#paramSearchDto.systemCode} )  " +
//            "and (:#{#paramSearchDto.beginDateLocalDate} is null OR m.processCreateTime >= :#{#paramSearchDto.beginDateLocalDate} )  " +
//            "and (:#{#paramSearchDto.endDateLocalDate} is null OR m.processCreateTime <= :#{#paramSearchDto.endDateLocalDate} )  " +
//            "and (:#{#paramSearchDto.hasProcessEnd} is null OR m.isClose = :#{#paramSearchDto.hasProcessEnd} )  " +
//            "and (coalesce(:#{#paramSearchDto.adminList}, null) is null or m.systemAdminAccount in (:#{#paramSearchDto.adminList})) " +
            "")
    Page<TradeAccountSaleFund> searchByParam(Pageable pageable, TradeAccountSaleFund paramSearchDto);
}



